home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / allfiles / angry / intro.dir / 00001_handlers.ls next >
Encoding:
Text File  |  1999-03-01  |  2.3 KB  |  125 lines

  1. global gLoopList, fileSep
  2.  
  3. on startMovie
  4.   gLoopList = []
  5.   initMovie()
  6.   repeat with i = 1 to 6
  7.     if soundBusy(i) then
  8.       sound stop i
  9.     end if
  10.   end repeat
  11. end
  12.  
  13. on initMovie
  14.   if the machineType = 256 then
  15.     fileSep = "\"
  16.   else
  17.     fileSep = ":"
  18.   end if
  19.   set the keyDownScript to "keyCheck"
  20. end
  21.  
  22. on keyCheck
  23.   setVolume()
  24. end
  25.  
  26. on setVolume
  27.   inKey = the key
  28.   if (inKey = "q") or (inKey = "Q") then
  29.     go("quitArtRight")
  30.   end if
  31.   if (charToNum(inKey) >= charToNum("0")) and (charToNum(inKey) <= charToNum("9")) then
  32.     newVol = integer(the key)
  33.     if the soundLevel <> newVol then
  34.       set the soundLevel to newVol
  35.     end if
  36.   end if
  37. end
  38.  
  39. on deg2radian thisMany
  40.   return thisMany * (2 * PI / 360)
  41. end
  42.  
  43. on radian2deg thisMany
  44.   return integer(thisMany * (360 / (2 * PI)))
  45. end
  46.  
  47. on flyGravity theBody, thisMass, thatLoc, thatMass, maxRadius, action
  48.   body1 = theBody
  49.   mass1 = thisMass
  50.   gPoint = thatLoc
  51.   gMass = thatMass
  52.   rMax = maxRadius
  53.   mouseMass = thisMass * 2
  54.   mouseLoc = point(the mouseH, the mouseV)
  55.   deltaLoc = mouseLoc - the loc of sprite body1
  56.   dX = getAt(deltaLoc, 1)
  57.   dY = getAt(deltaLoc, 2)
  58.   r = sqrt((dX * dX) + (dY * dY))
  59.   if r = 0 then
  60.     r = 0.01
  61.   end if
  62.   if r > 60 then
  63.     r = 60
  64.   end if
  65.   g = 0.01
  66.   f = g * mass1 * mouseMass / r
  67.   if action = "attract" then
  68.     g = 0.01 * (r * 2.10000000000000009)
  69.   else
  70.     if r < rMax then
  71.       g = -0.01 * (r * 2.10000000000000009)
  72.     else
  73.       g = 0.0
  74.     end if
  75.   end if
  76.   f = g * mass1 * gMass / r
  77.   Fx = 0
  78.   Fy = 0
  79.   if dX <> 0.0 then
  80.     Fx = f * dX / r
  81.     if abs(Fx) > 2000 then
  82.       Fx = 0.0
  83.     end if
  84.   end if
  85.   if dY <> 0.0 then
  86.     Fy = f * dY / r
  87.     if abs(Fy) > 2000 then
  88.       Fy = 0.0
  89.     end if
  90.   end if
  91.   return [#x: Fx, #Y: Fy]
  92. end
  93.  
  94. on calcGravity theBody, thisMass
  95.   body1 = theBody
  96.   mass1 = thisMass
  97.   mouseMass = thisMass * 2
  98.   mouseLoc = point(the mouseH, the mouseV)
  99.   deltaLoc = mouseLoc - the loc of sprite body1
  100.   dX = getAt(deltaLoc, 1)
  101.   dY = getAt(deltaLoc, 2)
  102.   r = sqrt((dX * dX) + (dY * dY))
  103.   if r = 0 then
  104.     r = 0.01
  105.   end if
  106.   if r > 60 then
  107.     r = 60
  108.   end if
  109.   g = 0.01
  110.   f = g * mass1 * mouseMass / r
  111.   if dX <> 0.0 then
  112.     Fx = f * dX / r
  113.     if abs(Fx) > 2000 then
  114.       Fx = 0.0
  115.     end if
  116.   end if
  117.   if dY <> 0.0 then
  118.     Fy = f * dY / r
  119.     if abs(Fy) > 2000 then
  120.       Fy = 0.0
  121.     end if
  122.   end if
  123.   return [#x: Fx, #Y: Fy]
  124. end
  125.